

#include "stdafx.h"

#include "../../loader.h"
using namespace dlguif;

#include <iostream>
using std::cout;
using std::cerr;
using std::endl;


Loader loader;


void CALLBACK  OnGui(void* user_context, const callback_info* ci)
{
	static int count = 0;
	count ++;

	cout << "GUI event! " << count << endl;
	cout << "tag: " << ci->tag << endl;
	cout << "type: " << Loader::event_type_to_string(ci->eventType) << endl;
	cout << "Param1: " << ci->param1 <<  endl;
	cout << "Param2: " << ci->param2 <<  endl;
	cout << "Class name: " << ci->class_name << endl;
	cout << "Name: " << ci->name << endl;
	cout << "--------------------------" << endl;

	if(ci->eventType == EVENT_TYPE_FORM_CLOSE)
	{
		loader.PostExit(0);
	}

}


int _tmain(int argc, _TCHAR* argv[])
{
	 //(L"j:/dlguif/dlguif/delphi_dll_project/dlguif.dll");
	loader.SetGuiEventCallBack(OnGui, NULL);

	void* pform = loader.CreateForm( "form", "form", 10, 10, 800, 600 );

	loader.SetFormIconFromFile(pform, "128.ico");


	void* pc = NULL;
	loader.CreatePageControl(&pc, pform, pform,
		&Loader::MakeRectangle(20, 20, 500, 400) );

	void* ts0 = loader.CreatePageControlTabSheet(pc, "page0");
	void* ts1 = loader.CreatePageControlTabSheet(pc, "page1");
	void* ts2 = loader.CreatePageControlTabSheet(pc, "page2");
	void* ts3 = loader.CreatePageControlTabSheet(pc, "page3");
	void* ts4 = loader.CreatePageControlTabSheet(pc, "page4");


	loader.ShowForm(pform);

	while(loader.ProcessMessages() )
	{
		Sleep(1);
	}




	return 0;
}
